{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_dir = \"./data_item.csv\"\n",
    "data = pd.read_csv(data_dir)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "# data2 = data.sample(frac=1) # 打乱数据\n",
    "# data2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "dates = pd.to_datetime(data['time'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>behavior_type</th>\n",
       "      <th>user_geohash</th>\n",
       "      <th>item_category</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>0</td>\n",
       "      <td>10001082</td>\n",
       "      <td>285259775</td>\n",
       "      <td>1</td>\n",
       "      <td>97lk14c</td>\n",
       "      <td>4076</td>\n",
       "      <td>2014-12-08 18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>1</td>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>2</td>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>3</td>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9762</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>4</td>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>5</td>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9762</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>6</td>\n",
       "      <td>10001082</td>\n",
       "      <td>290088061</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>7</td>\n",
       "      <td>10001082</td>\n",
       "      <td>298397524</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>8</td>\n",
       "      <td>10001082</td>\n",
       "      <td>32104252</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6513</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>9</td>\n",
       "      <td>10001082</td>\n",
       "      <td>323339743</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10</td>\n",
       "      <td>10001082</td>\n",
       "      <td>396795886</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2825</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>11</td>\n",
       "      <td>10001082</td>\n",
       "      <td>9947871</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2825</td>\n",
       "      <td>2014-11-28 20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>12</td>\n",
       "      <td>10001082</td>\n",
       "      <td>150720867</td>\n",
       "      <td>1</td>\n",
       "      <td>95qoghe</td>\n",
       "      <td>3200</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>13</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-03 01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>14</td>\n",
       "      <td>10001082</td>\n",
       "      <td>97441652</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-11-20 21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>15</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-13 14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>16</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>17</td>\n",
       "      <td>10001082</td>\n",
       "      <td>220586551</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7079</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>18</td>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6669</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>19</td>\n",
       "      <td>10001082</td>\n",
       "      <td>266563343</td>\n",
       "      <td>1</td>\n",
       "      <td>95qobus</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>20</td>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>21</td>\n",
       "      <td>10001082</td>\n",
       "      <td>209290607</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5894</td>\n",
       "      <td>2014-12-14 16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>22</td>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6669</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>23</td>\n",
       "      <td>10001082</td>\n",
       "      <td>22667958</td>\n",
       "      <td>1</td>\n",
       "      <td>95qogn4</td>\n",
       "      <td>10523</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>24</td>\n",
       "      <td>10001082</td>\n",
       "      <td>125083630</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4722</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>25</td>\n",
       "      <td>10001082</td>\n",
       "      <td>236453039</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>26</td>\n",
       "      <td>10001082</td>\n",
       "      <td>282931871</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6000</td>\n",
       "      <td>2014-12-10 13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>27</td>\n",
       "      <td>10001082</td>\n",
       "      <td>266188611</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10223</td>\n",
       "      <td>2014-11-20 19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>28</td>\n",
       "      <td>10001082</td>\n",
       "      <td>302705570</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>29</td>\n",
       "      <td>10001082</td>\n",
       "      <td>45258196</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>behavior_type</th>\n",
       "      <th>user_geohash</th>\n",
       "      <th>item_category</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>0</td>\n",
       "      <td>10001082</td>\n",
       "      <td>285259775</td>\n",
       "      <td>1</td>\n",
       "      <td>97lk14c</td>\n",
       "      <td>4076</td>\n",
       "      <td>2014-12-08 18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>1</td>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>2</td>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>3</td>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9762</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>4</td>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>5</td>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9762</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>6</td>\n",
       "      <td>10001082</td>\n",
       "      <td>290088061</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5503</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>7</td>\n",
       "      <td>10001082</td>\n",
       "      <td>298397524</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>8</td>\n",
       "      <td>10001082</td>\n",
       "      <td>32104252</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6513</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>9</td>\n",
       "      <td>10001082</td>\n",
       "      <td>323339743</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10</td>\n",
       "      <td>10001082</td>\n",
       "      <td>396795886</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2825</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>11</td>\n",
       "      <td>10001082</td>\n",
       "      <td>9947871</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2825</td>\n",
       "      <td>2014-11-28 20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>12</td>\n",
       "      <td>10001082</td>\n",
       "      <td>150720867</td>\n",
       "      <td>1</td>\n",
       "      <td>95qoghe</td>\n",
       "      <td>3200</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>13</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-03 01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>14</td>\n",
       "      <td>10001082</td>\n",
       "      <td>97441652</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-11-20 21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>15</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-13 14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>16</td>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>17</td>\n",
       "      <td>10001082</td>\n",
       "      <td>220586551</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7079</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>18</td>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6669</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>19</td>\n",
       "      <td>10001082</td>\n",
       "      <td>266563343</td>\n",
       "      <td>1</td>\n",
       "      <td>95qobus</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>20</td>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5232</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>21</td>\n",
       "      <td>10001082</td>\n",
       "      <td>209290607</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5894</td>\n",
       "      <td>2014-12-14 16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>22</td>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6669</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>23</td>\n",
       "      <td>10001082</td>\n",
       "      <td>22667958</td>\n",
       "      <td>1</td>\n",
       "      <td>95qogn4</td>\n",
       "      <td>10523</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>24</td>\n",
       "      <td>10001082</td>\n",
       "      <td>125083630</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4722</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>25</td>\n",
       "      <td>10001082</td>\n",
       "      <td>236453039</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10576</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>26</td>\n",
       "      <td>10001082</td>\n",
       "      <td>282931871</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6000</td>\n",
       "      <td>2014-12-10 13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>27</td>\n",
       "      <td>10001082</td>\n",
       "      <td>266188611</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10223</td>\n",
       "      <td>2014-11-20 19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>28</td>\n",
       "      <td>10001082</td>\n",
       "      <td>302705570</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>29</td>\n",
       "      <td>10001082</td>\n",
       "      <td>45258196</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5894</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.set_index(dates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>behavior_type</th>\n",
       "      <th>item_category</th>\n",
       "      <th>user_geohash</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>266188611</td>\n",
       "      <td>1</td>\n",
       "      <td>10223</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-20 19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>97441652</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-20 21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>9947871</td>\n",
       "      <td>1</td>\n",
       "      <td>2825</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-28 20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>6669</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>6669</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>1</td>\n",
       "      <td>9762</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>4</td>\n",
       "      <td>9762</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-03 01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>236453039</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>285259775</td>\n",
       "      <td>1</td>\n",
       "      <td>4076</td>\n",
       "      <td>97lk14c</td>\n",
       "      <td>2014-12-08 18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>282931871</td>\n",
       "      <td>1</td>\n",
       "      <td>6000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-10 13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>266563343</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>95qobus</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>396795886</td>\n",
       "      <td>1</td>\n",
       "      <td>2825</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>323339743</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>298397524</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>302705570</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>32104252</td>\n",
       "      <td>1</td>\n",
       "      <td>6513</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>290088061</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>45258196</td>\n",
       "      <td>1</td>\n",
       "      <td>5894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-13 14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>220586551</td>\n",
       "      <td>1</td>\n",
       "      <td>7079</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>125083630</td>\n",
       "      <td>1</td>\n",
       "      <td>4722</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>209290607</td>\n",
       "      <td>1</td>\n",
       "      <td>5894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>22667958</td>\n",
       "      <td>1</td>\n",
       "      <td>10523</td>\n",
       "      <td>95qogn4</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>150720867</td>\n",
       "      <td>1</td>\n",
       "      <td>3200</td>\n",
       "      <td>95qoghe</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>behavior_type</th>\n",
       "      <th>item_category</th>\n",
       "      <th>user_geohash</th>\n",
       "      <th>time</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>266188611</td>\n",
       "      <td>1</td>\n",
       "      <td>10223</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-20 19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>97441652</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-20 21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>9947871</td>\n",
       "      <td>1</td>\n",
       "      <td>2825</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-28 20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>6669</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>296378545</td>\n",
       "      <td>1</td>\n",
       "      <td>6669</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>1</td>\n",
       "      <td>9762</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>53616768</td>\n",
       "      <td>4</td>\n",
       "      <td>9762</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-02 15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-03 01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>236453039</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-08 07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>285259775</td>\n",
       "      <td>1</td>\n",
       "      <td>4076</td>\n",
       "      <td>97lk14c</td>\n",
       "      <td>2014-12-08 18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>282931871</td>\n",
       "      <td>1</td>\n",
       "      <td>6000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-10 13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>151466952</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>266563343</td>\n",
       "      <td>1</td>\n",
       "      <td>5232</td>\n",
       "      <td>95qobus</td>\n",
       "      <td>2014-12-12 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>4368907</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>396795886</td>\n",
       "      <td>1</td>\n",
       "      <td>2825</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>323339743</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>298397524</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>302705570</td>\n",
       "      <td>1</td>\n",
       "      <td>10894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>32104252</td>\n",
       "      <td>1</td>\n",
       "      <td>6513</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>290088061</td>\n",
       "      <td>1</td>\n",
       "      <td>5503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>45258196</td>\n",
       "      <td>1</td>\n",
       "      <td>5894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-12 12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>275221686</td>\n",
       "      <td>1</td>\n",
       "      <td>10576</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-13 14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>220586551</td>\n",
       "      <td>1</td>\n",
       "      <td>7079</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>125083630</td>\n",
       "      <td>1</td>\n",
       "      <td>4722</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>209290607</td>\n",
       "      <td>1</td>\n",
       "      <td>5894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-12-14 16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>22667958</td>\n",
       "      <td>1</td>\n",
       "      <td>10523</td>\n",
       "      <td>95qogn4</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>10001082</td>\n",
       "      <td>150720867</td>\n",
       "      <td>1</td>\n",
       "      <td>3200</td>\n",
       "      <td>95qoghe</td>\n",
       "      <td>2014-12-15 08</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_data = pd.DataFrame(data, columns=['user_id','item_id','behavior_type', 'item_category', 'user_geohash', 'time'])\n",
    "new_data = new_data.set_index(dates,drop= True)\n",
    "new_data_label = pd.DataFrame(new_data,columns=['item_id'], index=None)\n",
    "new_data.sort_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>item_id</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>266188611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>97441652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>9947871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>296378545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>296378545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>53616768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>53616768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>236453039</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>285259775</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>282931871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>151466952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>151466952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>266563343</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>4368907</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>4368907</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>396795886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>323339743</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>298397524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>302705570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>32104252</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>290088061</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>45258196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>220586551</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>125083630</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>209290607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>22667958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>150720867</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>item_id</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>time</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-11-20 19:00:00</th>\n",
       "      <td>266188611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-20 21:00:00</th>\n",
       "      <td>97441652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-28 20:00:00</th>\n",
       "      <td>9947871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>296378545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 12:00:00</th>\n",
       "      <td>296378545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>53616768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-02 15:00:00</th>\n",
       "      <td>53616768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-03 01:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>236453039</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 07:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-08 18:00:00</th>\n",
       "      <td>285259775</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-10 13:00:00</th>\n",
       "      <td>282931871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>151466952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>151466952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 11:00:00</th>\n",
       "      <td>266563343</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>4368907</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>4368907</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>396795886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>323339743</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>298397524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>302705570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>32104252</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>290088061</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-12 12:00:00</th>\n",
       "      <td>45258196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-13 14:00:00</th>\n",
       "      <td>275221686</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>220586551</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 03:00:00</th>\n",
       "      <td>125083630</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-14 16:00:00</th>\n",
       "      <td>209290607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>22667958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-12-15 08:00:00</th>\n",
       "      <td>150720867</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_data_label.sort_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
